'use strict';

module.exports = {
  // 在执行数据库升级时调用的函数，创建 users 表
  up: async (queryInterface, Sequelize) => {
    const {
      INTEGER,
      DATE,
      STRING
    } = Sequelize;
    await queryInterface.createTable('users', {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true
      },
      username: {
        ype: STRING,
        allowNull: false
      },
      password: {
        type: STRING,
        allowNull: false
      },
      nickname: {
        type: STRING,
        allowNull: false
      },
      desc: {
        type: STRING,
        allowNull: false
      },
      cover: {
        type: STRING,
        allowNull: false
      },
      createTime: DATE,
      updateTime: DATE
    });
  },
  // 在执行数据库降级时调用的函数，删除 users 表
  down: async queryInterface => {
    await queryInterface.dropTable('users');
  },
};